/**
 * Created by Administrator on 2015/1/25.
 */

var config = require('./config');
var utils = require('./utils');


exports.info = function (msg, obj) {
    log("info", msg, obj);
}

exports.error = function (msg, err) {
    log("error", "error:");
    console.log(err)
}

exports.debug = function (msg, obj) {
    if (!config.debugEnable()) {
        return;
    }
    log("debug", msg, obj);
}

var log = function (level, msg, obj) {
    if (obj) {
        msg = msg + ":" + JSON.stringify(obj);
    }
    console.log("[" + level + "][" + utils.getNowTimeStr() + "]" + msg);
}